/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.vtc.app;

import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

/**
 *
 * @author Admin
 */
public class BaseSprite extends Sprite {

    protected int speed;
    public int dir;
    public static final int LEFT = 1;
    public static final int RIGHT = 2;
    public static final int DOWN = 3;
    public static final int UP = 4;


    public BaseSprite(Image image, int frameWidth, int frameHeight, int speed) {
        super(image, frameWidth, frameHeight);
        this.speed = speed;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getDir() {
        return dir;
    }

    public void setDir(int dir) {
        this.dir = dir;
    }

    public void moveSprite() {
        switch (dir) {
            case (LEFT):
                super.move(-speed, 0);
                break;
            case (RIGHT):
                super.move(+speed, 0);
                break;
            case (UP):
                super.move(0, -speed);
                break;
            case (DOWN):
                super.move(0, +speed);
                break;
        }
    }
}
